package com.yugao.fintech.antelope.mps.assembly;

import com.yugao.fintech.antelope.mps.model.entity.MsgHistory;
import com.yugao.fintech.antelope.mps.model.entity.MsgPushTask;
import com.yugao.fintech.antelope.mps.model.rqrs.history.HistoryQueryResp;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 消息推送
 *

 */
@Mapper(componentModel = "spring")
public interface MsgHistoryAssembly {

    @Mappings({
            @Mapping(source = "pushTask.name", target = "taskName"),
            @Mapping(source = "history.id", target = "id"),
            @Mapping(source = "history.taskId", target = "taskId"),
            @Mapping(source = "history.channelCode", target = "channelCode"),
            @Mapping(source = "history.groupName", target = "groupName"),
            @Mapping(source = "pushTask.taskCode", target = "taskCode"),
            @Mapping(source = "history.channelType", target = "channelType"),
            @Mapping(source = "history.originalTemplateVar", target = "tplData"),
            @Mapping(source = "history.status", target = "status"),
            @Mapping(source = "history.pushResult", target = "pushResult"),
            @Mapping(source = "history.toUser", target = "toUser"),
            @Mapping(source = "history.pushTime", target = "pushTime"),
            @Mapping(source = "history.bizKey", target = "bizKey"),
            @Mapping(source = "history.bizType", target = "bizType"),
    })
    HistoryQueryResp toMsgHistoryQueryResp(MsgHistory history, MsgPushTask pushTask);
}